#include<iostream>
#include<iomanip>
using namespace std;
int main()
{double x,y,x1,y1,x2,y2,x3,y3,x4,y4;
 int n;
 cin>>n;
 cout<<"INTERSECTING LINES OUTPUT"<<endl; 
 for(int i=1;i<=n;i++)
   {double k=0,b=0;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if(x1==x2||x3==x4) 
    {if(x1==x2&&x3==x4&&x1!=x3)  
           {cout<<"NONE"<<endl;continue;}
     if(x1==x2&&x3==x4&&x1==x3)  
           {cout<<"LINE"<<endl;continue;}
     if(x1==x2&&x3!=x4)       
           {k=(double) (y4-y3)/(x4-x3);b=y4-k*x4;y=k*x1+b;cout<<setiosflags(ios::fixed)<<setprecision(2);cout<<"POINT "<<x1<<" "<<y<<endl;continue;}
     if(x1!=x2&&x3==x4)       
           {k=(double) (y2-y1)/(x2-x1);b=y2-k*x2;y=k*x3+b;cout<<setiosflags(ios::fixed)<<setprecision(2);cout<<"POINT "<<x3<<" "<<y<<endl;continue;}
     }
    double k1=0,b1=0,k2=0,b2=0;
    k1= (y2-y1)/(x2-x1);
    b1=  y2-k1*x2;
    k2= (y4-y3)/(x4-x3);
    b2= y4-k2*x4;
    if(k1==k2&&b1!=b2)  
           {cout<<"NONE"<<endl; continue;}
    if(k1==k2&&b1==b2)  
           {cout<<"LINE"<<endl;continue;}
    double n,m;
    n=(k2*b1-k1*b2)/(k2-k1);
    if(k1==0)   
           { m=(y3-b2)/k2;cout<<setiosflags(ios::fixed)<<setprecision(2);cout<<"POINT "<<m<<" "<<n<<endl;continue;}
    if(k2==0)   
           { m=(y1-b1)/k1;cout<<setiosflags(ios::fixed)<<setprecision(2);cout<<"POINT "<<m<<" "<<n<<endl;continue;}
    m=(n-b1)/k1;
    cout<<setiosflags(ios::fixed)<<setprecision(2);
    cout<<"POINT "<<m<<" "<<n<<endl;
}
cout<<"END OF OUTPUT"<<endl;
system("pause");
return 0;
}
